/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bda.mediatheque.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

/**
 *
 * @author samsung
 */
@Entity
@Table(name = "lignedepanier")
@NamedQueries({
    @NamedQuery(name = "Lignedepanier.findAll", query = "SELECT l FROM Lignedepanier l")})
public class Lignedepanier implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id @GeneratedValue(strategy=GenerationType.AUTO)
    @Basic(optional = false)
    @NotNull
    @Column(name = "ligneDePanierID")
    private Integer ligneDePanierID;
    @JoinColumn(name = "exemplaire", referencedColumnName = "exemplaireId")
    @OneToOne (cascade = CascadeType.MERGE,fetch=FetchType.LAZY)
    private Exemplaire exemplaire;
    @JoinColumn(name = "panier", referencedColumnName = "panierId")
    @ManyToOne(optional = false)
    private Panier panier;

    public Lignedepanier() {
    }

    public Lignedepanier(Integer ligneDePanierID) {
        this.ligneDePanierID = ligneDePanierID;
    }

    public Integer getLigneDePanierID() {
        return ligneDePanierID;
    }

    public void setLigneDePanierID(Integer ligneDePanierID) {
        this.ligneDePanierID = ligneDePanierID;
    }

    public Exemplaire getExemplaire() {
        return exemplaire;
    }

    public void setExemplaire(Exemplaire exemplaire) {
        this.exemplaire = exemplaire;
    }

    public Panier getPanier() {
        return panier;
    }

    public void setPanier(Panier panier) {
        this.panier = panier;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ligneDePanierID != null ? ligneDePanierID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Lignedepanier)) {
            return false;
        }
        Lignedepanier other = (Lignedepanier) object;
        if ((this.ligneDePanierID == null && other.ligneDePanierID != null) || (this.ligneDePanierID != null && !this.ligneDePanierID.equals(other.ligneDePanierID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bda.mediatheque.dao.Lignedepanier[ ligneDePanierID=" + ligneDePanierID + " ]";
    }
    
}
